home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: Comma Delimited function wanted
- Date: Sat, 13 Jan 96 00:21:21 GMT
- Organization: none
- Message-ID: <821492481snz@genesis.demon.co.uk>
- References: <4d1l42$mb6@voyager.Internex.NET> <4d4gic$p7u@umbc9.umbc.edu> <4d6gi2$g4r@news.iag.net>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <4d6gi2$g4r@news.iag.net> jatmon@iag.net "John R Buchan" writes:
-
- > char *buffer = "3740067099,,P03,5000";
- >
- >A strtok based solution will have a similar problem. A full solution to
- >this type of parsing will require a non-standard function (custom code).
-
- I don't recommend passing pointers to string literals as strtok's first
- argument. If a token exists strtok will attempt to modify the string
- by null character terminating the token. With string literals this
- results in undefined behaviour. better would be:
-
- static char buffer[] = "3740067099,,P03,5000";
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-